// utils/share.js

export function updateCurrentPageShare() {
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];
    const uid = wx.getStorageSync('share_user_id') || '';

    if (!currentPage) return;

    currentPage.onShareAppMessage = function () {
        return {
            title: '三脚猫知识问答',
            path: `/pages/yd_home/home?referrer_id=${uid}`,
            imageUrl: '/static/img/share.jpg'
        };
    };

    currentPage.onShareTimeline = function () {
        return {
            title: '三脚猫知识问答',
            query: `referrer_id=${uid}`,        
            imageUrl: '/static/img/share.jpg'
        };
    };
}
